
#ifndef LOGSTRINGFORMATTER_H_
#define LOGSTRINGFORMATTER_H_

#include <chrono>
//#include <cstdio>
#include <iostream>

#include "Logger/LogLogger.h"
#include "Logger/SafeCTimeAccess.h"

namespace logger {

/**
 * A class used to format log strings.
 */
class LogStringFormatter {
public:
    LogStringFormatter();

    /**
     * Formats a log message into a printable string with other metadata regarding the log message.
     *
     * @param level The severity Level of this log line.
     * @param time The time that the event to log occurred.
     * @param threadMoniker Moniker of the thread that generated the event.
     * @param text The text of the entry to log.
     * @return The formatted string.
     */
    std::string format(
        Level level,
        std::chrono::system_clock::time_point time,
        const char* text);

    /**
     * Transforms a time_point into a string representing the date and time.
     *
     * @param time The time_point.
     * @return A string representing the time_point in "%Y-%m-%d %H:%M:%S" format, or an empty string if failure.
     */
    std::string getDateTimeString(std::chrono::system_clock::time_point time);

    /**
     * Transforms a time_point into a string representing the milliseconds.
     *
     * @param time The time_point.
     * @return A string representing the number of milliseconds, or an empty string if failure.
     */
    std::string getMillisecondString(std::chrono::system_clock::time_point time);

private:
    std::shared_ptr<timing::SafeCTimeAccess> m_safeCTimeAccess;
};

}  // namespace logger

#endif  // LOGSTRINGFORMATTER_H_
